﻿using Prism.Events;
using Prism.Regions;

namespace LpbPrj.Client.Event
{
    public class MessageSentEvent : PubSubEvent<MessageEvent>
    {
    }

    /// <summary>
    /// 组件发布和订阅事件的数据类型
    /// </summary>
    public class MessageEvent
    {
        public string MsgKey { get; set; }

        public string MsgToken { get; set; }

        public NavigationParameters MsgParam { get; set; }

        public MessageEvent(string msgKey, NavigationParameters msgParam = null, string msgToken = null)
        {
            if (msgParam == null) msgParam = new NavigationParameters();
            MsgKey = msgKey;
            MsgParam = msgParam;
            MsgToken = msgToken;
        }

        public MessageEvent(string msgKey, object msgParam, string msgToken = null)
        {
            MsgKey = msgKey;
            MsgToken = msgToken;
            MsgParam = new NavigationParameters();
            MsgParam.Add("Param", msgParam);
        }
    }

}
